The field of the present invention is the management of memory resources for an electronic device. More particularly, the present invention relates to managing memory for a device having an embedded processor and memory system.
Many electronic devices use embedded processors. For example mobile electronic devices often include embedded processors, microprocessors, or other controllers for controlling the device and providing an interface to a user. More specifically, devices such as mobile wireless phones, personal data assistants, MP3 players, and cameras generally included embedded processors for monitoring, operating, and using these devices. Also, many consumer devices such as DVD players, CD players, stereo equipment, appliances, and motor vehicles include embedded operational controllers. These devices often have limited memory, such as RAM memory, to keep costs down. Also, these device's embedded controllers typically have limited processing capability, with the processor and memory carefully selected to avoid excess processing power. Such excess processing power unnecessarily raises the cost of the device. Also, if the device is portable or operates on battery power, then such excess processing power may drain scarce battery power and exacerbate heat issues. In this way, the embedded processor's limited memory, limited processor power, and simple structure cooperate to make cost sensitive and reliable devices.
A mobile wireless handset is one example of a portable device having an embedded processor and a limited memory system. The embedded processor in the mobile phone operates applications for call processing, diagnostics, and support applications. New mobile handsets are becoming more complex, offering the capability to send and receive high speed data, as well as receive and process GPS signals for location and position information. Further, consumers are demanding more interesting and more useful interaction with their mobile handsets. For example, modern mobile handsets often operate games, music players, contact managers, and digital cameras. All these new applications and requirements are placing increasing pressure on the embedded processor and memory systems.
Applications, such as a user application or an operating system application, need memory space to execute or to store data. Since memory space on the device is limited, memory is dynamically allocated to each application as that application requires additional memory space. Embedded processors, as well as other processors, generally use a memory manager to manage memory resources. When an application needs additional memory space, the application makes a memory allocation request to the memory manager. The memory manager locates a segment of free memory that is typically larger than the request, and allocates the requested memory to the application. When the application ends, or the application no longer needs the memory, the application informs the memory manager that the memory space may be de-allocated. The memory manger then places the memory back in the memory pool, where it becomes available for a future allocation.
The memory manager is typically allocating memory to many concurrent processes and applications, and continually returning blocks back into the available memory pool. Since the memory requests and allocations are of varying sizes, and may be quite random, over time the memory becomes fragmented and under utilized. For example, if the memory manager receives an allocation request for 850 bytes, it may find a free memory block of 1 k (1024) bytes in the memory pool. The memory manager will allocate 850 bytes to handle the memory request, leaving a small free block of only 174 bytes. Unless a very small allocation request is received, these 174 bytes will not be used. The memory manager must expend considerable processing resources in managing and reclaiming memory resources, and even with such effort, the memory system remains underutilized and fragmented.